package com.moyun.websocket.controller;

import cn.hutool.core.lang.Dict;
import com.moyun.websocket.model.Server;
import com.moyun.websocket.payload.ServerVO;
import com.moyun.websocket.util.ServerUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName ServerController
 * @Description 服务器监控Controller
 * @Author yangboxuan
 * @Date 2021/6/26 17:49
 */
@Api(tags = "服务器信息监控")
@RestController
@RequestMapping("/server")
public class ServerController {

    @ApiOperation("获取服务器信息")
    @GetMapping("/serverInfo")
    public Dict serverInfo() throws Exception {
        Server server = new Server();
        server.copyTo();
        ServerVO serverVO = ServerUtil.wrapServerVO(server);
        return ServerUtil.wrapServerDict(serverVO);
    }

}
